<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="favicon.ico">
    <link rel="Shortcut Icon" href="favicon.ico"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin.pro/css/h-ui.admin.pro.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.9/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/business/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script><![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <title>入住学生信息</title>
    <meta name="keywords" content="h-ui.admin.pro v1.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
    <meta name="description" content="h-ui.admin.pro v1.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="clearfix pd-20">
    <div class="clearfix mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th width="50">编号</th>
                <th width="100">姓名</th>
                <th width="40">年龄</th>
                <th width="90">学号</th>
                <th width="150">入住时间</th>
                <th width="150">入住天数</th>
            </tr>
            </thead>
            <tbody class="getData-list" data-currPage='1'>

            </tbody>
        </table>
    </div>


</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/3.1.1/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="static/h-ui.admin.pro/js/h-ui.admin.pro.js"></script>
<!--/_footer /作为公共模版分离出去-->


<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">

    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]);
        return null; //返回参数值
    }

    var dormId = getUrlParam('dormId')
    $(function () {
        var data = {'dormId': dormId};
        $.ajax({
            url: 'stuDormitory?action=queryStudentInfoByDormId',
            type: 'post',
            data: data,
            dataType: 'json',
            success(result) {
                var datas = result
                var htmlstr = '';
                var d = new Date();
                for (var i = 0; i < datas.length; i++) {
                    var rangeDateNum = (d.getTime() - (datas[i].createTime)) / (1000 * 3600 * 24);
                    htmlstr +=
                        '<tr class="text-c">' +
                        '<td>' + i + 1 + '</td>' +
                        '<td>' + datas[i].realName + '</td>' +
                        '<td>' + datas[i].age + '</td>' +
                        '<td>' + datas[i].stuId + '</td>' +
                        '<td>' + new Date(parseInt(datas[i].createTime)).toLocaleString().replace(/:\d{1,2}$/, ' ') + '</td>' +
                        '<td>' + Math.ceil(rangeDateNum) + '</td>';
                    htmlstr += '</td>' +
                        '</tr>';
                }
                // 在页面对应<tbody class=".getData-list">标签中输出拼接好的html结构。
                //$(".dormId").html(htmlstr);
                $(".getData-list").html(htmlstr);
            }
        })
    })

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>